import { E_GameBaseAttr } from "../defs/com/E_GameBaseAttr";
import { CDMath } from "../excel/CDMath";
import { CDMathx } from "../excel/CDMathx";
import { CDSkill } from "../excel/CDSkill";
import { CEMath } from "../excel_extend/CEMath";



/**
 * 数据-技能
 */
export abstract class SDSkill {



    /**
     * 将技能的基础属性统计到输出
     * @param skillID 
     * @param skillLevel 
     * @param outList 
     * @param isMonster 
     * @returns 
     */
    public static addGameBaseAttr(skillID: number, skillLevel: number, outList: number[], isMonster: boolean): void {
        if (!outList) {
            return;
        }

        const skillConfig = CDSkill.getData(skillID);
        if (!skillConfig || 0 === skillConfig.math) {
            return;
        }

        if (isMonster) {
            const skillMatmConfig = CDMathx.getData(skillConfig.math);
            if (!skillMatmConfig) {
                return;
            }

            for (let i = 0, len = E_GameBaseAttr.EnumCount; i < len; i++) {
                const idx = CEMath.getExcelTypeXXXByGameAttrType(i);
                outList[i] += skillMatmConfig.getAttr(idx);
            }
        }
        else {
            const skillMatmConfig = CDMath.getData(skillConfig.math);
            if (!skillMatmConfig) {
                return;
            }

            for (let i = 0, len = E_GameBaseAttr.EnumCount; i < len; i++) {
                const idx = CEMath.getExcelTypeByGameAttrType(i);
                outList[i] += skillMatmConfig.getAttr(idx);
            }
        }

    }




}
